function W=randn_vec(Q)
% randn_vec: Generate a random Gaussian noise vector with specified covariance matrix
%
% SYNTAX:
%   W = randn_vec(G)
%   Return generated random Gaussian noise vector.

%   Author: Hongbin Ma
%   Last updated: 2009-6-2 with MATLAB 6.5
%   Problems or suggestions? Email me: mathmhb[at]163.com

warning off MATLAB:sqrtm:SingularMatrix
n=size(Q,1);
W=sqrtm(Q)*randn(n,1);